////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//                           BailterRay                                       //
//                    Pip Robbins & Zhao Zhang                                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
class BailterRay_GooRotatingTurret extends BailterRay_GooTurret
                     placeable;

var rotator FireAim;
var bool bRotateClockWise;
var bool bWaiting;

const ROTATION_SPEED	      = 5000;

simulated function Tick(float DeltaTime)
{

    if(!PlayerCanSeeMe())
       return;

    if(!bWaiting)
    {
        if(bRotateClockWise)
        {
            if(FireAim.Pitch > -32768)
            {
                FireAim.Pitch -= DeltaTime * ROTATION_SPEED;

            }else
            {
                bWaiting = true;
                setTimer(0.4, false, 'wait');
            }
        }
        if(!bRotateClockWise)
        {
            if(FireAim.Pitch < 0)
            {
                FireAim.Pitch += DeltaTime * ROTATION_SPEED;

            }else
            {
                bWaiting = true;
                setTimer(0.4, false, 'wait');
            }
        }
    }

    //Update Weapon Direction
    WeaponComponent.SetRotation(FireAim);

    Super.Tick(DeltaTime);
}

function wait()
{
    if(bRotateClockWise)
        bRotateClockWise = false;
    else
        bRotateClockWise = true;
    bWaiting = false;
}



defaultproperties
{
    bRotateClockWise = true
    bWaiting = false

    //Turret Type
    Begin Object Name=Proj
		ProjectileClass=class'BailterRayProj_Goo'
		MuzzleFlash=ParticleSystem'WP_BioRifle.Particles.P_WP_Bio_3P_MF'
		DeathEffect=ParticleSystem'WP_BioRifle.Particles.P_WP_Bio_Alt_Blob_POP'
		DeathSound = SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireAltImpactExplode_Cue'
		FireSound = SoundCue'A_Character_BodyImpacts.BodyImpacts.A_Character_BodyImpact_GibLarge_Cue'
		FireInterval=1
	End Object
	GooTurret=Proj
}